package com.chukun.flink.stream.operator.base;

import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;


/**
 * @author chukun
 * @version 1.0.0
 * @description union的操作符
 * @createTime 2022年05月10日 00:06:00
 */
public class UnionOperator {

    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStream<Long> dataStream01 = env.fromSequence(1,5);

        DataStream<Long> dataStream02 = env.fromSequence(1000,1005);

        DataStream<Long> resultStream = dataStream01.union(dataStream02);

        resultStream.print("输出结果");

        // 触发程序执行
        env.execute("union stream");
    }
}
